//dispenser.cpp
/********************************************************************************
*																				*
*	Author:			Jared Szechy												*
*	Assignment:		Assignment 1												*
*	Class:			CPS-151														*
*	Instructor:		V. Starkley													*
*	Due Date:		August 30													*
*																				*
*	This file implements functions in the dispenser class.						*
*																				*
********************************************************************************/

#include "dispenser.h"
#include <iostream>
#include <string>
using namespace std;

//constructor functions

Dispenser::Dispenser()
{
	quantityOnHand = 0;
}

Dispenser::Dispenser(string name, double cst, int quant)
{
	productName = name;
	cost = cst;
	quantityOnHand = quant;
}

//mutator functions

void Dispenser::setProductName(string name)
{
	productName = name;
}

void Dispenser::setCost(double cst)
{
	cost = cst;
}

void Dispenser::setQuantityOnHand(int quantity)
{
	quantityOnHand = quantity;
}

void Dispenser::makeSale()
{
	quantityOnHand--;
}

//accessor functions

string Dispenser::getProductName()
{
	return productName;
}

double Dispenser::getCost()
{
	return cost;
}

int Dispenser::getQuantityOnHand()
{
	return quantityOnHand;
}

//overload operators

ostream& operator << (ostream& fout, Dispenser d)
{
	fout << d.productName << endl << "$" << d.cost << endl << d.quantityOnHand << endl;
	return fout;
}

bool Dispenser::operator == (Dispenser disp) const
{
	return productName == disp.getProductName();
}